Written by Marco Piovanelli <mailto:piovanel@kagi.com>
This folder contains some sample code that shows how to display a navigation pop-up menu like the one shown by version 7.x of the Finder when you command-click a window title.
This call takes a file system specification referring to some document and creates a new menu ready to be displayed in a window title bar or somewhere else. The first item in the menu corresponds to the document itself; additional items refer to the enclosing folders and/or disk. Each menu item has an associated small icon, just like the Finder. If the menu cannot be created for some reason, this call returns nil.
Call this when you detect a command-click in the drag bar of the frontmost window. Pass in the window reference, the specification of the file associated with the window and the hit point (in local coordinates): TrackDirectoryPopup will check to see if the click went into the title bar area of the window, create a directory menu (using BuildDirectoryMenu), display the menu and do all the necessary mouse tracking. If a selection is made, TrackDirectoryPopup will return true and set ioFileSpec to the specification of the selected folder.
To show this code in action, I have included a small sample application: DPSample. Just drag any file onto DPSample and command-click the title bar of the resulting window.
Warning: the sample application requires System 7.0 and a 68020+ CPU.